package collection;

import java.util.ArrayList;
import java.util.List;

//飞机大战
public class ListDemoOne {
    public static void main(String[] args){
        List<String> list = new ArrayList<>();//多态的思想
        list.add("飞机");
        list.add("坦克");
        list.add("汽车");
        list.add("火车");
        System.out.println("list:"+list);

       for (int i = 0;i<list.size();i++)System.out.println(list.get(i));
       System.out.println("~~~~~~~~~~~~~~~~~~~~~~");
        System.out.println(list.set(2, "轮船"));
        System.out.println("list:"+list);

    }
}
